#include "GAF_Canvas.h"

namespace GAF
{
	Canvas::Canvas()
	{
		m_isEnabled	= false;
	}

	Canvas::~Canvas()
	{
		Disabled();
// 		ClearGarphicses(); // 无法连接通过
	}

	bool Canvas::Init(WindowHandle pWndHandle)
	{
		return OnInit(pWndHandle);
	}

	bool Canvas::Enabled()
	{
		if(!m_isEnabled)
		{
			if(OnEnabled())
			{
				m_isEnabled = true;
				return true;
			}
		}
		return false;
	}

	void Canvas::Disabled()
	{
		if(m_isEnabled)
		{
			OnDisabled();
			m_isEnabled = false;
		}
	}

	bool Canvas::Render()
	{
		if(m_isEnabled)
		{
			return OnRender();
		}
		return false;
	}
}
